using System.Threading.Tasks;

namespace ThingsGateway.Foundation.Rpc
{
    /// <summary>
    /// RpcActionFilterAttribute
    /// </summary>
    public abstract class RpcActionFilterAttribute : Attribute, IRpcActionFilter
    {
        /// <inheritdoc/>
        public virtual void Executed(ICallContext callContext, object[] parameters, ref InvokeResult invokeResult)
        {
        }

        /// <inheritdoc/>
        public virtual Task ExecutedAsync(ICallContext callContext, object[] parameters, ref InvokeResult invokeResult)
        {
            return EasyTask.CompletedTask;
        }

        /// <inheritdoc/>
        public virtual void ExecutException(ICallContext callContext, object[] parameters, ref InvokeResult invokeResult, Exception exception)
        {
        }

        /// <inheritdoc/>
        public virtual Task ExecutExceptionAsync(ICallContext callContext, object[] parameters, ref InvokeResult invokeResult, Exception exception)
        {
            return EasyTask.CompletedTask;
        }

        /// <inheritdoc/>
        public virtual void Executing(ICallContext callContext, object[] parameters, ref InvokeResult invokeResult)
        {
        }

        /// <inheritdoc/>
        public virtual Task ExecutingAsync(ICallContext callContext, object[] parameters, ref InvokeResult invokeResult)
        {
            return EasyTask.CompletedTask;
        }
    }
}